home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 July: Mac OS SDK / Dev.CD Jul 00 SDK2.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / Power.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  46.0 KB  |  1,145 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        Power.h
  3.  
  4.      Contains:    Power Manager Interfaces.
  5.  
  6.      Version:    Technology:    Mac OS 9
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1990-1999 by Apple Computer, Inc.  All rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __POWER__
  18. #define __POWER__
  19.  
  20. #ifndef __MACTYPES__
  21.     #include <MacTypes.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28. #ifndef __MULTIPROCESSING__
  29.     #include <Multiprocessing.h>
  30. #endif
  31.  
  32. #ifndef __NAMEREGISTRY__
  33.     #include <NameRegistry.h>
  34. #endif
  35.  
  36. #ifndef __MACERRORS__
  37.     #include <MacErrors.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. enum {
  64.                                                                 /* Bit positions for ModemByte */
  65.     modemOnBit                    = 0,
  66.     ringWakeUpBit                = 2,
  67.     modemInstalledBit            = 3,
  68.     ringDetectBit                = 4,
  69.     modemOnHookBit                = 5
  70. };
  71.  
  72. enum {
  73.                                                                 /* masks for ModemByte */
  74.     modemOnMask                    = 0x01,
  75.     ringWakeUpMask                = 0x04,
  76.     modemInstalledMask            = 0x08,
  77.     ringDetectMask                = 0x10,
  78.     modemOnHookMask                = 0x20
  79. };
  80.  
  81. enum {
  82.                                                                 /* bit positions for BatteryByte */
  83.     chargerConnBit                = 0,
  84.     hiChargeBit                    = 1,
  85.     chargeOverFlowBit            = 2,
  86.     batteryDeadBit                = 3,
  87.     batteryLowBit                = 4,
  88.     connChangedBit                = 5
  89. };
  90.  
  91. enum {
  92.                                                                 /* masks for BatteryByte */
  93.     chargerConnMask                = 0x01,
  94.     hiChargeMask                = 0x02,
  95.     chargeOverFlowMask            = 0x04,
  96.     batteryDeadMask                = 0x08,
  97.     batteryLowMask                = 0x10,
  98.     connChangedMask                = 0x20
  99. };
  100.  
  101. enum {
  102.                                                                 /* bit positions for SoundMixerByte */
  103.     MediaBaySndEnBit            = 0,
  104.     PCISndEnBit                    = 1,
  105.     ZVSndEnBit                    = 2,
  106.     PCCardSndEnBit                = 3
  107. };
  108.  
  109. enum {
  110.                                                                 /* masks for SoundMixerByte */
  111.     MediaBaySndEnMask            = 0x01,
  112.     PCISndEnMask                = 0x02,
  113.     ZVSndEnMask                    = 0x04,
  114.     PCCardSndEnMask                = 0x08
  115. };
  116.  
  117. enum {
  118.                                                                 /* commands to SleepQRec sleepQProc */
  119.     kSleepRequest                = 1,
  120.     kSleepDemand                = 2,
  121.     kSleepWakeUp                = 3,
  122.     kSleepRevoke                = 4,
  123.     kSleepUnlock                = 4,
  124.     kSleepDeny                    = 5,
  125.     kSleepNow                    = 6,
  126.     kDozeDemand                    = 7,
  127.     kDozeWakeUp                    = 8,
  128.     kDozeRequest                = 9,                            /* additional messages for Power Mgr 2.0*/
  129.     kEnterStandby                = 10,
  130.     kEnterRun                    = 11,
  131.     kSuspendRequest                = 12,
  132.     kSuspendDemand                = 13,
  133.     kSuspendRevoke                = 14,
  134.     kSuspendWakeUp                = 15,
  135.     kGetPowerLevel                = 16,
  136.     kSetPowerLevel                = 17,
  137.     kDeviceInitiatedWake        = 18,
  138.     kWakeToDoze                    = 19,
  139.     kDozeToFullWakeUp            = 20,
  140.     kGetPowerInfo                = 21,
  141.     kGetWakeOnNetInfo            = 22
  142. };
  143.  
  144. enum {
  145.                                                                 /* depreciated commands to SleepQRec sleepQProc */
  146.     sleepRequest                = kSleepRequest,
  147.     sleepDemand                    = kSleepDemand,
  148.     sleepWakeUp                    = kSleepWakeUp,
  149.     sleepRevoke                    = kSleepRevoke,
  150.     sleepUnlock                    = kSleepUnlock,
  151.     sleepDeny                    = kSleepDeny,
  152.     sleepNow                    = kSleepNow,
  153.     dozeDemand                    = kDozeDemand,
  154.     dozeWakeUp                    = kDozeWakeUp,
  155.     dozeRequest                    = kDozeRequest,
  156.     enterStandby                = kEnterStandby,
  157.     enterRun                    = kEnterRun,
  158.     suspendRequestMsg            = kSuspendRequest,
  159.     suspendDemandMsg            = kSuspendDemand,
  160.     suspendRevokeMsg            = kSuspendRevoke,
  161.     suspendWakeUpMsg            = kSuspendWakeUp,
  162.     getPowerLevel                = kGetPowerLevel,
  163.     setPowerLevel                = kSetPowerLevel
  164. };
  165.  
  166. /* Power Handler func messages */
  167. typedef UInt32                             PowerLevel;
  168. /* Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS) */
  169. enum {
  170.     kPMDevicePowerLevel_On        = 0,                            /* fully-powered 'On' state (D0 state)    */
  171.     kPMDevicePowerLevel_D1        = 1,                            /* not used by Apple system SW            */
  172.     kPMDevicePowerLevel_D2        = 2,                            /* not used by Apple system SW            */
  173.     kPMDevicePowerLevel_Off        = 3                                /* main PCI bus power 'Off', but PCI standby power available (D3cold state) */
  174. };
  175.  
  176. /* PowerHandlerProc definition */
  177. typedef CALLBACK_API( OSStatus , PowerHandlerProcPtr )(UInt32 message, void *param, UInt32 refCon, RegEntryID *regEntryID);
  178. typedef STACK_UPP_TYPE(PowerHandlerProcPtr)                     PowerHandlerUPP;
  179. #if OPAQUE_UPP_TYPES
  180.     EXTERN_API(PowerHandlerUPP)
  181.     NewPowerHandlerUPP               (PowerHandlerProcPtr        userRoutine);
  182.  
  183.     EXTERN_API(void)
  184.     DisposePowerHandlerUPP           (PowerHandlerUPP            userUPP);
  185.  
  186.     EXTERN_API(OSStatus)
  187.     InvokePowerHandlerUPP           (UInt32                    message,
  188.                                     void *                    param,
  189.                                     UInt32                    refCon,
  190.                                     RegEntryID *            regEntryID,
  191.                                     PowerHandlerUPP            userUPP);
  192.  
  193. #else
  194.     enum { uppPowerHandlerProcInfo = 0x00003FF0 };                     /* pascal 4_bytes Func(4_bytes, 4_bytes, 4_bytes, 4_bytes) */
  195.     #define NewPowerHandlerUPP(userRoutine)                         (PowerHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPowerHandlerProcInfo, GetCurrentArchitecture())
  196.     #define DisposePowerHandlerUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  197.     #define InvokePowerHandlerUPP(message, param, refCon, regEntryID, userUPP)  (OSStatus)CALL_FOUR_PARAMETER_UPP((userUPP), uppPowerHandlerProcInfo, (message), (param), (refCon), (regEntryID))
  198. #endif
  199. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  200. #define NewPowerHandlerProc(userRoutine)                         NewPowerHandlerUPP(userRoutine)
  201. #define CallPowerHandlerProc(userRoutine, message, param, refCon, regEntryID) InvokePowerHandlerUPP(message, param, refCon, regEntryID, userRoutine)
  202. /* DriverPowerCapabilities struct */
  203. /*
  204.    The DriverPowerCapabilities structure is used only by PPC native drivers (ndrv).
  205.    A native driver will export this structure like it currently does now when
  206.    exporting a DriverDescription structure (e.g. TheDriverDescription).
  207.    The well-defined export that will be exported must be called: TheDriverPowerCapabilities
  208.    IMPORTANT NOTE:    ALL native drivers that match to their respective PCI
  209.                       slot devices MUST signify to the Power Manager that
  210.                       they can recover their device functionality after
  211.                       waking from Sleep with PCI bus power removed.
  212.                       If ANY PCI slot driver has not been updated and fails
  213.                       to indicate to the Power Manager that it can recover
  214.                       after PCI bus power is restored, then PCI bus power
  215.                       will NOT be removed during Sleep.  Without the ability
  216.                       to remove PCI bus power, the ability to switch the main
  217.                       power supply on some CPUs to a very-low power state
  218.                       will be unavailable to the System.
  219.    The PowerCapsFlags are used to determine:
  220.       - if a PCI slot device can recover from PCI power removal during Sleep.
  221.         Drivers should set the 'kDevicePowerCanBeRemovedForSleep' bit if true.
  222.           ***  ALL PCI slot device drivers must set this bit in order    ***
  223.           ***  that PCI bus power is allowed to be removed during Sleep. ***
  224.       - if the driver overrides the device's PCI Config space for determining
  225.         how much Standby (e.g. 3.3V Aux pin) power is used during Sleep.
  226.         Drivers should set the 'kDriverSpecifiesStandbyPower' bit only if the
  227.         device's PCI Config values are known to be corrupted or do not specify
  228.         the Standby power consumed during D3cold.
  229.           If 'kDriverSpecifiesStandbyPower' bit is set:
  230.             - the 'kDeviceCanGeneratePMEDuringSleep' bit should be set if
  231.               the PCI slot device is able to use standby (3.3V Aux) power
  232.               to assert the PME signal during Sleep..
  233.             - the 'powerCapsStandbyPowerMilliWatts' field is used to specify
  234.               how much Standby power is needed.  This value is only used
  235.               if both the 'kDriverSpecifiesStandbyPower' and
  236.               'kDeviceCanGeneratePMEDuringSleep' bits are set.
  237.       - the method of support chosen by the driver for implementing the Power
  238.         handler mechanism:
  239.           If 'kDriverPowerMgtAware' is set, then the driver supports the Power
  240.           Handler mechanism which exists in the new Power Manager (v2.0 and later).
  241.           If 'kDriverPowerMgtUnderExpertControl' is set, then the Power Manager
  242.           will assume that the driver's Expert/Manager will communicate with the
  243.           driver's Power handler and the 'kDriverHasPowerHandlerExport bit'
  244.           will be ignored.
  245.           If 'kDriverHasPowerHandlerExport' is set, then the driver must export
  246.           a well-defined Power handler entry point called:
  247.               DoDriverPowerManagement
  248.           If this bit is not set and the 'kDriverPowerMgtAware' is set, then the
  249.           device must support Power handling within its DoDriverIO entry point.
  250.           Drivers that implement a DoDriverIO entry point will receive
  251.           IO Control and Status selectors that are defined in Devices.h.
  252.           Drivers that elect to export a "DoDriverPowerManagement" entry point should
  253.           set up the entry point as follows:
  254.               OSStatus
  255.               DoDriverPowerManagement( UInt32                message,
  256.                                        PowerLevel             *powerLevel,
  257.                                        UInt32                 refCon,
  258.                                        RegEntryIDPtr         regEntryID);
  259.           "DoDriverPowerManagement" entry points have the same parameters and expected
  260.           behavior as a Power handler that has been explicitly registered via the
  261.           Driver Services API "AddDevicePowerHandler"; the difference is that,
  262.           during system startup, the Power Manager will automatically register the
  263.           "DoDriverPowerManagement" entry point found within each driver.
  264. */
  265.  
  266. /* Used in DriverPowerCapabilities*/
  267. typedef UInt32                             PowerCapsVersion;
  268. enum {
  269.     kVersionOnePowerCapabilities = 1
  270. };
  271.  
  272. typedef OptionBits                         PowerCapsFlags;
  273. enum {
  274.     kDevicePowerCanBeRemovedForSleep = 0x00000001,                /* only remove PCI power when every device has this bit set */
  275.     kDriverSpecifiesStandbyPower = 0x00000002,                    /* set when driver overrides PCI device Config values */
  276.     kDeviceCanGeneratePMEDuringSleep = 0x00000004,                /* 3.3V standby power can be used to assert the PME# */
  277.     kDriverPowerMgtAware        = 0x00000008,                    /* new Power handler mechanism is supported */
  278.     kDriverPowerMgtUnderExpertControl = 0x00000010,                /* Expert or Manager will call the driver's Power handler */
  279.     kDriverHasPowerHandlerExport = 0x00000020                    /* Type of Power handler entry point: only set this bit if the */
  280. };
  281.  
  282. /*     driver exports a "DevicePowerManagement" entry point */
  283. /*
  284.    A device reliability issue arises when a device is subjected to shortened power
  285.    cycling intervals.  The new Power Manager allows a device to specify a minimum
  286.    value (in seconds) that a device must be powered on before being powered off.
  287.    The system has a default value of around 5 minutes (300 seconds).  If 5 minutes
  288.    is sufficient for a device, then use the following constant within DriverPowerCapabilities.
  289. */
  290. enum {
  291.     kUseDefaultWakeTime            = 0                                /* used when the system's default is sufficient */
  292. };
  293.  
  294. /*
  295.    This structure describes a device's power capabilities as well as general Power Management support.
  296.       Note: powerCapsMinimumWakeTimeSeconds can be specified as kUseDefaultWakeTime
  297.       if the system's default time interval - 5 minutes - is sufficient.
  298. */
  299.  
  300. struct DriverPowerCapabilities {
  301.     PowerCapsVersion                 powerCapsVersion;            /* Version of this data structure */
  302.     PowerCapsFlags                     powerCapsFlags;                /* Power Management support characteristics */
  303.     UInt32                             powerCapsStandbyPowerMilliWatts; /* Power consumed during PCI bus sleep, 0 if none */
  304.     UInt32                             powerCapsMinimumWakeTimeSeconds; /* Safe time interval between removing and */
  305.                                                                 /*   restoring power to this device */
  306. };
  307. typedef struct DriverPowerCapabilities    DriverPowerCapabilities;
  308. typedef DriverPowerCapabilities *        DriverPowerCapabilitiesPtr;
  309. /* PCI power management support*/
  310. enum {
  311.     kUseDefaultMinimumWakeTime    = 0,                            /* Defaults to 5 minutes*/
  312.     kPowerSummaryVersion        = 1,                            /* Version of PowerSummary structure.*/
  313.     kDevicePowerInfoVersion        = 1                                /* Version of DevicePowerInfo structure.*/
  314. };
  315.  
  316. enum {
  317.                                                                 /* PowerSummary flags*/
  318.     kPCIPowerOffAllowed            = (1L << 0)                        /* PCI power off is allowed.*/
  319. };
  320.  
  321. enum {
  322.                                                                 /* DevicePowerInfo flags*/
  323.     kDevicePCIPowerOffAllowed    = (1L << 0),                    /* PCI power off is allowed for device.*/
  324.     kDeviceSupportsPMIS            = (1L << 1),                    /* Device supports Power Mgt Interface Spec.*/
  325.     kDeviceCanAssertPMEDuringSleep = (1L << 2),                    /* Device can assert PME# during sleep.*/
  326.     kDeviceUsesCommonLogicPower    = (1L << 3),                    /* Device uses common-logic power*/
  327.     kDeviceDriverPresent        = (1L << 4),                    /* Driver present for device.*/
  328.     kDeviceDriverSupportsPowerMgt = (1L << 5)                    /* Driver installed a power handler.*/
  329. };
  330.  
  331.  
  332. struct DevicePowerInfo {
  333.     UInt32                             version;                    /* Version of this structure.*/
  334.     RegEntryID                         regID;                        /* RegEntryID for device.*/
  335.     OptionBits                         flags;                        /* Flags*/
  336.     UInt32                             minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  337.     UInt32                             sleepPowerNeeded;            /* Milliwatts needed in the sleep state.*/
  338. };
  339. typedef struct DevicePowerInfo            DevicePowerInfo;
  340.  
  341. struct PowerSummary {
  342.     UInt32                             version;                    /* Version of this structure.*/
  343.     OptionBits                         flags;                        /* Flags*/
  344.     UInt32                             sleepPowerAvailable;        /* Milliwatts available during sleep.*/
  345.     UInt32                             sleepPowerNeeded;            /* Milliwatts needed during sleep.*/
  346.     UInt32                             minimumWakeTime;            /* Minimum seconds before sleeping again.*/
  347.     ItemCount                         deviceCount;                /* Number of device power info records.*/
  348.     DevicePowerInfo                 devices[1];                    /* Array of device power info records.*/
  349. };
  350. typedef struct PowerSummary                PowerSummary;
  351. enum {
  352.                                                                 /* SleepQRec.sleepQFlags */
  353.     noCalls                        = 1,
  354.     noRequest                    = 2,
  355.     slpQType                    = 16,
  356.     sleepQType                    = 16
  357. };
  358.  
  359. /* Power Mgt Apple Event types and errors */
  360. enum {
  361.                                                                 /* power mgt class*/
  362.     kAEMacPowerMgtEvt            = FOUR_CHAR_CODE('pmgt'),        /* event ids*/
  363.     kAEMacToWake                = FOUR_CHAR_CODE('wake'),
  364.     kAEMacLowPowerSaveData        = FOUR_CHAR_CODE('pmsd'),
  365.     kAEMacEmergencySleep        = FOUR_CHAR_CODE('emsl'),
  366.     kAEMacEmergencyShutdown        = FOUR_CHAR_CODE('emsd')
  367. };
  368.  
  369.  
  370. /*
  371.    These are result values returned by a Power Handler when queries
  372.    by the Power Mgr if the device which that Power Handler represents
  373.    woke the machine.
  374. */
  375. enum {
  376.     kDeviceDidNotWakeMachine    = 0,                            /* device did NOT wake machine*/
  377.     kDeviceRequestsFullWake        = 1,                            /* device did wake machine and requests full wakeup*/
  378.     kDeviceRequestsWakeToDoze    = 2                                /* device did wake machine and requests partial wakeup*/
  379. };
  380.  
  381. /* bits in bitfield returned by PMFeatures */
  382. enum {
  383.     hasWakeupTimer                = 0,                            /* 1=wakeup timer is supported                                */
  384.     hasSharedModemPort            = 1,                            /* 1=modem port shared by SCC and internal modem            */
  385.     hasProcessorCycling            = 2,                            /* 1=processor cycling is supported                            */
  386.     mustProcessorCycle            = 3,                            /* 1=processor cycling should not be turned off                */
  387.     hasReducedSpeed                = 4,                            /* 1=processor can be started up at reduced speed            */
  388.     dynamicSpeedChange            = 5,                            /* 1=processor speed can be switched dynamically            */
  389.     hasSCSIDiskMode                = 6,                            /* 1=SCSI Disk Mode is supported                            */
  390.     canGetBatteryTime            = 7,                            /* 1=battery time can be calculated                            */
  391.     canWakeupOnRing                = 8,                            /* 1=can wakeup when the modem detects a ring                */
  392.     hasDimmingSupport            = 9,                            /* 1=has dimming support built in (DPMS standby by default)    */
  393.     hasStartupTimer                = 10,                            /* 1=startup timer is supported                                */
  394.     hasChargeNotification        = 11,                            /* 1=client can determine of charge connect status change notifications available */
  395.     hasDimSuspendSupport        = 12                            /* 1=supports dimming LCD and CRT to DPMS suspend state        */
  396. };
  397.  
  398. /* more bits in bitfield returned by PMFeatures to be merged with above when time */
  399. enum {
  400.     hasWakeOnNetActivity        = 13,                            /* 1=hardware supports wake on network activity                */
  401.     hasWakeOnLid                = 14,                            /* 1=hardware can wake when opened                            */
  402.     canPowerOffPCIBus            = 15,                            /* 1=hardware can power off PCI bus during sleep if cards allow */
  403.     hasDeepSleep                = 16,                            /* 1=hardware supports deep sleep (hibernation) mode        */
  404.     hasSleep                    = 17                            /* 1=hardware supports normal (PowerBook-like) sleep        */
  405. };
  406.  
  407. /* bits in bitfield returned by GetIntModemInfo and set by SetIntModemState */
  408. enum {
  409.     hasInternalModem            = 0,                            /* 1=internal modem installed                        */
  410.     intModemRingDetect            = 1,                            /* 1=internal modem has detected a ring                */
  411.     intModemOffHook                = 2,                            /* 1=internal modem is off hook                        */
  412.     intModemRingWakeEnb            = 3,                            /* 1=wakeup on ring is enabled                        */
  413.     extModemSelected            = 4,                            /* 1=external modem selected                        */
  414.     modemSetBit                    = 15                            /* 1=set bit, 0=clear bit (SetIntModemState)        */
  415. };
  416.  
  417. /* bits in BatteryInfo.flags                                     */
  418. /* ("chargerConnected" doesn't mean the charger is plugged in)    */
  419. enum {
  420.     batteryInstalled            = 7,                            /* 1=battery is currently connected                    */
  421.     batteryCharging                = 6,                            /* 1=battery is being charged                        */
  422.     chargerConnected            = 5                                /* 1=charger is connected to the PowerBook            */
  423. };
  424.  
  425. enum {
  426.     HDPwrQType                    = 0x4844,                        /* 'HD' hard disk spindown queue element type        */
  427.     PMgrStateQType                = 0x504D                        /* 'PM' Power Manager state queue element type        */
  428. };
  429.  
  430. /* client notification bits in PMgrQueueElement.pmNotifyBits */
  431. enum {
  432.     pmSleepTimeoutChanged        = 0,
  433.     pmSleepEnableChanged        = 1,
  434.     pmHardDiskTimeoutChanged    = 2,
  435.     pmHardDiskSpindownChanged    = 3,
  436.     pmDimmingTimeoutChanged        = 4,
  437.     pmDimmingEnableChanged        = 5,
  438.     pmDiskModeAddressChanged    = 6,
  439.     pmProcessorCyclingChanged    = 7,
  440.     pmProcessorSpeedChanged        = 8,
  441.     pmWakeupTimerChanged        = 9,
  442.     pmStartupTimerChanged        = 10,
  443.     pmHardDiskPowerRemovedbyUser = 11,
  444.     pmChargeStatusChanged        = 12,
  445.     pmPowerLevelChanged            = 13,
  446.     pmWakeOnNetActivityChanged    = 14
  447. };
  448.  
  449. enum {
  450.     pmSleepTimeoutChangedMask    = (1 << pmSleepTimeoutChanged),
  451.     pmSleepEnableChangedMask    = (1 << pmSleepEnableChanged),
  452.     pmHardDiskTimeoutChangedMask = (1 << pmHardDiskTimeoutChanged),
  453.     pmHardDiskSpindownChangedMask = (1 << pmHardDiskSpindownChanged),
  454.     pmDimmingTimeoutChangedMask    = (1 << pmDimmingTimeoutChanged),
  455.     pmDimmingEnableChangedMask    = (1 << pmDimmingEnableChanged),
  456.     pmDiskModeAddressChangedMask = (1 << pmDiskModeAddressChanged),
  457.     pmProcessorCyclingChangedMask = (1 << pmProcessorCyclingChanged),
  458.     pmProcessorSpeedChangedMask    = (1 << pmProcessorSpeedChanged),
  459.     pmWakeupTimerChangedMask    = (1 << pmWakeupTimerChanged),
  460.     pmStartupTimerChangedMask    = (1 << pmStartupTimerChanged),
  461.     pmHardDiskPowerRemovedbyUserMask = (1 << pmHardDiskPowerRemovedbyUser),
  462.     pmChargeStatusChangedMask    = (1 << pmChargeStatusChanged),
  463.     pmPowerLevelChangedMask        = (1 << pmPowerLevelChanged),
  464.     pmWakeOnNetActivityChangedMask = (1 << pmWakeOnNetActivityChanged)
  465. };
  466.  
  467. /* System Activity Selectors */
  468. enum {
  469.     OverallAct                    = 0,                            /* general type of activity                            */
  470.     UsrActivity                    = 1,                            /* user specific type of activity                    */
  471.     NetActivity                    = 2,                            /* network specific activity                        */
  472.     HDActivity                    = 3                                /* Hard Drive activity                                */
  473. };
  474.  
  475. /* Storage Media sleep mode defines */
  476. enum {
  477.     kMediaModeOn                = 0,                            /* Media active (Drive spinning and at full power)    */
  478.     kMediaModeStandBy            = 1,                            /* Media standby (not implemented)    */
  479.     kMediaModeSuspend            = 2,                            /* Media Idle (not implemented)    */
  480.     kMediaModeOff                = 3                                /* Media Sleep (Drive not spinning and at min power, max recovery time)    */
  481. };
  482.  
  483. enum {
  484.     kMediaPowerCSCode            = 70
  485. };
  486.  
  487.  
  488. /* definitions for HDQueueElement.hdFlags    */
  489. enum {
  490.     kHDQueuePostBit                = 0,                            /* 1 = call this routine on the second pass        */
  491.     kHDQueuePostMask            = (1 << kHDQueuePostBit)
  492. };
  493.  
  494.  
  495. struct ActivityInfo {
  496.     short                             ActivityType;                /* Type of activity to be fetched.  Same as UpdateSystemActivity Selectors */
  497.     unsigned long                     ActivityTime;                /* Time of last activity (in ticks) of specified type. */
  498. };
  499. typedef struct ActivityInfo                ActivityInfo;
  500. /* information returned by GetScaledBatteryInfo */
  501.  
  502. struct BatteryInfo {
  503.     UInt8                             flags;                        /* misc flags (see below)                            */
  504.     UInt8                             warningLevel;                /* scaled warning level (0-255)                        */
  505.     UInt8                             reserved;                    /* reserved for internal use                        */
  506.     UInt8                             batteryLevel;                /* scaled battery level (0-255)                        */
  507. };
  508. typedef struct BatteryInfo                BatteryInfo;
  509.  
  510. typedef SInt8                             ModemByte;
  511. typedef SInt8                             BatteryByte;
  512. typedef SInt8                             SoundMixerByte;
  513. typedef long                             PMResultCode;
  514. typedef struct SleepQRec                 SleepQRec;
  515. typedef SleepQRec *                        SleepQRecPtr;
  516. typedef struct HDQueueElement             HDQueueElement;
  517. typedef struct PMgrQueueElement         PMgrQueueElement;
  518. typedef CALLBACK_API( long , SleepQProcPtr )(long message, SleepQRecPtr qRecPtr);
  519. /*
  520.     WARNING: SleepQProcPtr uses register based parameters under classic 68k
  521.              and cannot be written in a high-level language without 
  522.              the help of mixed mode or assembly glue.
  523. */
  524. typedef CALLBACK_API( void , HDSpindownProcPtr )(HDQueueElement *theElement);
  525. typedef CALLBACK_API( void , PMgrStateChangeProcPtr )(PMgrQueueElement *theElement, long stateBits);
  526. typedef REGISTER_UPP_TYPE(SleepQProcPtr)                         SleepQUPP;
  527. typedef STACK_UPP_TYPE(HDSpindownProcPtr)                         HDSpindownUPP;
  528. typedef STACK_UPP_TYPE(PMgrStateChangeProcPtr)                     PMgrStateChangeUPP;
  529.  
  530. struct SleepQRec {
  531.     SleepQRecPtr                     sleepQLink;                    /* pointer to next queue element                */
  532.     short                             sleepQType;                    /* queue element type (must be SleepQType)        */
  533.     SleepQUPP                         sleepQProc;                    /* pointer to sleep universal proc ptr            */
  534.     short                             sleepQFlags;                /* flags                                        */
  535. };
  536.  
  537.  
  538. struct HDQueueElement {
  539.     struct HDQueueElement *            hdQLink;                    /* pointer to next queue element                */
  540.     short                             hdQType;                    /* queue element type (must be HDPwrQType)        */
  541.     short                             hdFlags;                    /* miscellaneous flags                            */
  542.     HDSpindownUPP                     hdProc;                        /* pointer to routine to call                    */
  543.     long                             hdUser;                        /* user-defined (variable storage, etc.)        */
  544. };
  545.  
  546.  
  547. struct PMgrQueueElement {
  548.     struct PMgrQueueElement *        pmQLink;                    /* pointer to next queue element                */
  549.     short                             pmQType;                    /* queue element type (must be PMgrStateQType)    */
  550.     short                             pmFlags;                    /* miscellaneous flags                            */
  551.     long                             pmNotifyBits;                /* bitmap of which changes to be notified for    */
  552.     PMgrStateChangeUPP                 pmProc;                        /* pointer to routine to call                    */
  553.     long                             pmUser;                        /* user-defined (variable storage, etc.)        */
  554. };
  555.  
  556.  
  557.  
  558. struct BatteryTimeRec {
  559.     unsigned long                     expectedBatteryTime;        /* estimated battery time remaining (seconds)    */
  560.     unsigned long                     minimumBatteryTime;            /* minimum battery time remaining (seconds)        */
  561.     unsigned long                     maximumBatteryTime;            /* maximum battery time remaining (seconds)        */
  562.     unsigned long                     timeUntilCharged;            /* time until battery is fully charged (seconds)*/
  563. };
  564. typedef struct BatteryTimeRec            BatteryTimeRec;
  565.  
  566.  
  567. struct WakeupTime {
  568.     unsigned long                     wakeTime;                    /* wakeup time (same format as current time)        */
  569.     Boolean                         wakeEnabled;                /* 1=enable wakeup timer, 0=disable wakeup timer    */
  570.     SInt8                             filler;
  571. };
  572. typedef struct WakeupTime                WakeupTime;
  573.  
  574.  
  575. struct StartupTime {
  576.     unsigned long                     startTime;                    /* startup time (same format as current time)        */
  577.     Boolean                         startEnabled;                /* 1=enable startup timer, 0=disable startup timer    */
  578.     SInt8                             filler;
  579. };
  580. typedef struct StartupTime                StartupTime;
  581. /* PowerSource version*/
  582. enum {
  583.     kVersionOnePowerSource        = 1
  584. };
  585.  
  586. /* PowerSourceAttrs bits*/
  587.  
  588. enum {
  589.     bSourceIsBattery            = 0,                            /* power source is battery*/
  590.     bSourceIsAC                    = 1,                            /* power source is AC*/
  591.     bSourceCanBeCharged            = 2,                            /* power source can be charged*/
  592.     bSourceIsUPS                = 3,                            /* power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate*/
  593.     kSourceIsBatteryMask        = (1 << bSourceIsBattery),
  594.     kSourceIsACMask                = (1 << bSourceIsAC),
  595.     kSourceCanBeChargedMask        = (1 << bSourceCanBeCharged),
  596.     kSourceIsUPSMask            = (1 << bSourceIsUPS)
  597. };
  598.  
  599. /* PowerSourceFlags bits*/
  600.  
  601. enum {
  602.     bSourceIsAvailable            = 0,                            /* power source is installed*/
  603.     bSourceIsCharging            = 1,                            /* power source being charged*/
  604.     bChargerIsAttached            = 2,                            /* a charger is connected*/
  605.     kSourceIsAvailableMask        = (1 << bSourceIsAvailable),
  606.     kSourceIsChargingMask        = (1 << bSourceIsCharging),
  607.     kChargerIsAttachedMask        = (1 << bChargerIsAttached)
  608. };
  609.  
  610. /* Power Capacity Types*/
  611.  
  612. enum {
  613.     kCapacityIsActual            = 0,                            /* current capacity is expessed as actual capacity in same units as max*/
  614.     kCapacityIsPercentOfMax        = 1                                /* current capacity is expressed as a percentage of maximumCapacity*/
  615. };
  616.  
  617. /* Net Activity Wake Options*/
  618. enum {
  619.     kConfigSupportsWakeOnNetBit    = 0,
  620.     kWakeOnNetAdminAccessesBit    = 1,
  621.     kWakeOnAllNetAccessesBit    = 2,
  622.     kUnmountServersBeforeSleepingBit = 3,
  623.     kConfigSupportsWakeOnNetMask = (1 << kConfigSupportsWakeOnNetBit),
  624.     kWakeOnNetAdminAccessesMask    = (1 << kWakeOnNetAdminAccessesBit),
  625.     kWakeOnAllNetAccessesMask    = (1 << kWakeOnAllNetAccessesBit),
  626.     kUnmountServersBeforeSleepingMask = (1 << kUnmountServersBeforeSleepingBit)
  627. };
  628.  
  629. /* Power Source capacity usage types*/
  630. enum {
  631.     kCurrentCapacityIsActualValue = 0,                            /* currentCapacity is a real value in same units as maxCapacity*/
  632.     kCurrentCapacityIsPercentOfMax = 1                            /* currentCapacity is expressed as a percentage of maxCapacity.*/
  633. };
  634.  
  635.  
  636. typedef SInt16                             PowerSourceID;
  637.  
  638. struct PowerSourceParamBlock {
  639.     PowerSourceID                     sourceID;                    /* unique id assigned by Power Mgr*/
  640.     UInt16                             sourceCapacityUsage;        /* how currentCapacity is used*/
  641.     UInt32                             sourceVersion;                /* version of this record*/
  642.     OptionBits                         sourceAttr;                    /* attribute flags (see below)*/
  643.     OptionBits                         sourceState;                /* state flags (see below)*/
  644.     UInt32                             currentCapacity;            /* current capacity, in*/
  645.                                                                 /*   milliwatts*/
  646.     UInt32                             maxCapacity;                /* full capacity, in milliwatts*/
  647.     UInt32                             timeRemaining;                /* time left to deplete, */
  648.                                                                 /*   in milliwatt-hours*/
  649.     UInt32                             timeToFullCharge;            /* time to charge, */
  650.                                                                 /*   in milliwatt-hours*/
  651.     UInt32                             voltage;                    /* voltage in millivolts*/
  652.     SInt32                             current;                    /* current in milliamperes */
  653.                                                                 /*  (negative if consuming, */
  654.                                                                 /*   positive if charging)*/
  655. };
  656. typedef struct PowerSourceParamBlock    PowerSourceParamBlock;
  657. typedef PowerSourceParamBlock *            PowerSourceParamBlockPtr;
  658. EXTERN_API( OSErr )
  659. DisableWUTime                    (void);
  660.  
  661. EXTERN_API( OSErr )
  662. SetWUTime                        (long                     wuTime);
  663.  
  664. EXTERN_API( OSErr )
  665. GetWUTime                        (long *                    wuTime,
  666.                                  Byte *                    wuFlag);
  667.  
  668. EXTERN_API( OSErr )
  669. BatteryStatus                    (Byte *                    status,
  670.                                  Byte *                    power);
  671.  
  672. EXTERN_API( OSErr )
  673. ModemStatus                        (Byte *                    status);
  674.  
  675.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  676.                                                                                             #pragma parameter __D0 IdleUpdate
  677.                                                                                             #endif
  678. EXTERN_API( long )
  679. IdleUpdate                        (void)                                                        ONEWORDINLINE(0xA285);
  680.  
  681.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  682.                                                                                             #pragma parameter __D0 GetCPUSpeed
  683.                                                                                             #endif
  684. EXTERN_API( long )
  685. GetCPUSpeed                        (void)                                                        TWOWORDINLINE(0x70FF, 0xA485);
  686.  
  687. EXTERN_API( void )
  688. EnableIdle                        (void)                                                        TWOWORDINLINE(0x7000, 0xA485);
  689.  
  690. EXTERN_API( void )
  691. DisableIdle                        (void)                                                        TWOWORDINLINE(0x7001, 0xA485);
  692.  
  693.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  694.                                                                                             #pragma parameter SleepQInstall(__A0)
  695.                                                                                             #endif
  696. EXTERN_API( void )
  697. SleepQInstall                    (SleepQRecPtr             qRecPtr)                            ONEWORDINLINE(0xA28A);
  698.  
  699.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  700.                                                                                             #pragma parameter SleepQRemove(__A0)
  701.                                                                                             #endif
  702. EXTERN_API( void )
  703. SleepQRemove                    (SleepQRecPtr             qRecPtr)                            ONEWORDINLINE(0xA48A);
  704.  
  705. EXTERN_API( void )
  706. AOn                                (void)                                                        TWOWORDINLINE(0x7004, 0xA685);
  707.  
  708. EXTERN_API( void )
  709. AOnIgnoreModem                    (void)                                                        TWOWORDINLINE(0x7005, 0xA685);
  710.  
  711. EXTERN_API( void )
  712. BOn                                (void)                                                        TWOWORDINLINE(0x7000, 0xA685);
  713.  
  714. EXTERN_API( void )
  715. AOff                            (void)                                                        TWOWORDINLINE(0x7084, 0xA685);
  716.  
  717. EXTERN_API( void )
  718. BOff                            (void)                                                        TWOWORDINLINE(0x7080, 0xA685);
  719.  
  720.  
  721. /* Public Power Management API  */
  722.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  723.                                                                                             #pragma parameter __D0 PMSelectorCount
  724.                                                                                             #endif
  725. EXTERN_API( short )
  726. PMSelectorCount                    (void)                                                        TWOWORDINLINE(0x7000, 0xA09E);
  727.  
  728.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  729.                                                                                             #pragma parameter __D0 PMFeatures
  730.                                                                                             #endif
  731. EXTERN_API( UInt32 )
  732. PMFeatures                        (void)                                                        TWOWORDINLINE(0x7001, 0xA09E);
  733.  
  734.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  735.                                                                                             #pragma parameter __D0 GetSleepTimeout
  736.                                                                                             #endif
  737. EXTERN_API( UInt8 )
  738. GetSleepTimeout                    (void)                                                        TWOWORDINLINE(0x7002, 0xA09E);
  739.  
  740.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  741.                                                                                             #pragma parameter SetSleepTimeout(__D0)
  742.                                                                                             #endif
  743. EXTERN_API( void )
  744. SetSleepTimeout                    (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0003, 0xA09E);
  745.  
  746.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  747.                                                                                             #pragma parameter __D0 GetHardDiskTimeout
  748.                                                                                             #endif
  749. EXTERN_API( UInt8 )
  750. GetHardDiskTimeout                (void)                                                        TWOWORDINLINE(0x7004, 0xA09E);
  751.  
  752.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  753.                                                                                             #pragma parameter SetHardDiskTimeout(__D0)
  754.                                                                                             #endif
  755. EXTERN_API( void )
  756. SetHardDiskTimeout                (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x0005, 0xA09E);
  757.  
  758.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  759.                                                                                             #pragma parameter __D0 HardDiskPowered
  760.                                                                                             #endif
  761. EXTERN_API( Boolean )
  762. HardDiskPowered                    (void)                                                        TWOWORDINLINE(0x7006, 0xA09E);
  763.  
  764.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  765.                                                                                             #pragma parameter SpinDownHardDisk
  766.                                                                                             #endif
  767. EXTERN_API( void )
  768. SpinDownHardDisk                (void)                                                        TWOWORDINLINE(0x7007, 0xA09E);
  769.  
  770.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  771.                                                                                             #pragma parameter __D0 IsSpindownDisabled
  772.                                                                                             #endif
  773. EXTERN_API( Boolean )
  774. IsSpindownDisabled                (void)                                                        TWOWORDINLINE(0x7008, 0xA09E);
  775.  
  776.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  777.                                                                                             #pragma parameter SetSpindownDisable(__D0)
  778.                                                                                             #endif
  779. EXTERN_API( void )
  780. SetSpindownDisable                (Boolean                 setDisable)                            FOURWORDINLINE(0x4840, 0x303C, 0x0009, 0xA09E);
  781.  
  782.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  783.                                                                                             #pragma parameter __D0 HardDiskQInstall(__A0)
  784.                                                                                             #endif
  785. EXTERN_API( OSErr )
  786. HardDiskQInstall                (HDQueueElement *        theElement)                            TWOWORDINLINE(0x700A, 0xA09E);
  787.  
  788.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  789.                                                                                             #pragma parameter __D0 HardDiskQRemove(__A0)
  790.                                                                                             #endif
  791. EXTERN_API( OSErr )
  792. HardDiskQRemove                    (HDQueueElement *        theElement)                            TWOWORDINLINE(0x700B, 0xA09E);
  793.  
  794.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  795.                                                                                             #pragma parameter GetScaledBatteryInfo(__D0, __A0)
  796.                                                                                             #endif
  797. EXTERN_API( void )
  798. GetScaledBatteryInfo            (short                     whichBattery,
  799.                                  BatteryInfo *            theInfo)                            FIVEWORDINLINE(0x4840, 0x303C, 0x000C, 0xA09E, 0x2080);
  800.  
  801.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  802.                                                                                             #pragma parameter AutoSleepControl(__D0)
  803.                                                                                             #endif
  804. EXTERN_API( void )
  805. AutoSleepControl                (Boolean                 enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x000D, 0xA09E);
  806.  
  807.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  808.                                                                                             #pragma parameter __D0 GetIntModemInfo
  809.                                                                                             #endif
  810. EXTERN_API( UInt32 )
  811. GetIntModemInfo                    (void)                                                        TWOWORDINLINE(0x700E, 0xA09E);
  812.  
  813.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  814.                                                                                             #pragma parameter SetIntModemState(__D0)
  815.                                                                                             #endif
  816. EXTERN_API( void )
  817. SetIntModemState                (short                     theState)                            FOURWORDINLINE(0x4840, 0x303C, 0x000F, 0xA09E);
  818.  
  819.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  820.                                                                                             #pragma parameter __D0 MaximumProcessorSpeed
  821.                                                                                             #endif
  822. EXTERN_API( short )
  823. MaximumProcessorSpeed            (void)                                                        TWOWORDINLINE(0x7010, 0xA09E);
  824.  
  825.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  826.                                                                                             #pragma parameter __D0 CurrentProcessorSpeed
  827.                                                                                             #endif
  828. EXTERN_API( short )
  829. CurrentProcessorSpeed            (void)                                                        TWOWORDINLINE(0x7011, 0xA09E);
  830.  
  831.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  832.                                                                                             #pragma parameter __D0 FullProcessorSpeed
  833.                                                                                             #endif
  834. EXTERN_API( Boolean )
  835. FullProcessorSpeed                (void)                                                        TWOWORDINLINE(0x7012, 0xA09E);
  836.  
  837.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  838.                                                                                             #pragma parameter __D0 SetProcessorSpeed(__D0)
  839.                                                                                             #endif
  840. EXTERN_API( Boolean )
  841. SetProcessorSpeed                (Boolean                 fullSpeed)                            FOURWORDINLINE(0x4840, 0x303C, 0x0013, 0xA09E);
  842.  
  843.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  844.                                                                                             #pragma parameter __D0 GetSCSIDiskModeAddress
  845.                                                                                             #endif
  846. EXTERN_API( short )
  847. GetSCSIDiskModeAddress            (void)                                                        TWOWORDINLINE(0x7014, 0xA09E);
  848.  
  849.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  850.                                                                                             #pragma parameter SetSCSIDiskModeAddress(__D0)
  851.                                                                                             #endif
  852. EXTERN_API( void )
  853. SetSCSIDiskModeAddress            (short                     scsiAddress)                        FOURWORDINLINE(0x4840, 0x303C, 0x0015, 0xA09E);
  854.  
  855.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  856.                                                                                             #pragma parameter GetWakeupTimer(__A0)
  857.                                                                                             #endif
  858. EXTERN_API( void )
  859. GetWakeupTimer                    (WakeupTime *            theTime)                            TWOWORDINLINE(0x7016, 0xA09E);
  860.  
  861.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  862.                                                                                             #pragma parameter SetWakeupTimer(__A0)
  863.                                                                                             #endif
  864. EXTERN_API( void )
  865. SetWakeupTimer                    (WakeupTime *            theTime)                            TWOWORDINLINE(0x7017, 0xA09E);
  866.  
  867.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  868.                                                                                             #pragma parameter __D0 IsProcessorCyclingEnabled
  869.                                                                                             #endif
  870. EXTERN_API( Boolean )
  871. IsProcessorCyclingEnabled        (void)                                                        TWOWORDINLINE(0x7018, 0xA09E);
  872.  
  873.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  874.                                                                                             #pragma parameter EnableProcessorCycling(__D0)
  875.                                                                                             #endif
  876. EXTERN_API( void )
  877. EnableProcessorCycling            (Boolean                 enable)                                FOURWORDINLINE(0x4840, 0x303C, 0x0019, 0xA09E);
  878.  
  879.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  880.                                                                                             #pragma parameter __D0 BatteryCount
  881.                                                                                             #endif
  882. EXTERN_API( short )
  883. BatteryCount                    (void)                                                        TWOWORDINLINE(0x701A, 0xA09E);
  884.  
  885.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  886.                                                                                             #pragma parameter __D0 GetBatteryVoltage(__D0)
  887.                                                                                             #endif
  888. EXTERN_API( Fixed )
  889. GetBatteryVoltage                (short                     whichBattery)                        FOURWORDINLINE(0x4840, 0x303C, 0x001B, 0xA09E);
  890.  
  891.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  892.                                                                                             #pragma parameter GetBatteryTimes(__D0, __A0)
  893.                                                                                             #endif
  894. EXTERN_API( void )
  895. GetBatteryTimes                    (short                     whichBattery,
  896.                                  BatteryTimeRec *        theTimes)                            FOURWORDINLINE(0x4840, 0x303C, 0x001C, 0xA09E);
  897.  
  898.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  899.                                                                                             #pragma parameter __D0 GetDimmingTimeout
  900.                                                                                             #endif
  901. EXTERN_API( UInt8 )
  902. GetDimmingTimeout                (void)                                                        TWOWORDINLINE(0x701D, 0xA09E);
  903.  
  904.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  905.                                                                                             #pragma parameter SetDimmingTimeout(__D0)
  906.                                                                                             #endif
  907. EXTERN_API( void )
  908. SetDimmingTimeout                (UInt8                     timeout)                            FOURWORDINLINE(0x4840, 0x303C, 0x001E, 0xA09E);
  909.  
  910.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  911.                                                                                             #pragma parameter DimmingControl(__D0)
  912.                                                                                             #endif
  913. EXTERN_API( void )
  914. DimmingControl                    (Boolean                 enableSleep)                        FOURWORDINLINE(0x4840, 0x303C, 0x001F, 0xA09E);
  915.  
  916.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  917.                                                                                             #pragma parameter __D0 IsDimmingControlDisabled
  918.                                                                                             #endif
  919. EXTERN_API( Boolean )
  920. IsDimmingControlDisabled        (void)                                                        TWOWORDINLINE(0x7020, 0xA09E);
  921.  
  922.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  923.                                                                                             #pragma parameter __D0 IsAutoSlpControlDisabled
  924.                                                                                             #endif
  925. EXTERN_API( Boolean )
  926. IsAutoSlpControlDisabled        (void)                                                        TWOWORDINLINE(0x7021, 0xA09E);
  927.  
  928.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  929.                                                                                             #pragma parameter __D0 PMgrStateQInstall(__A0)
  930.                                                                                             #endif
  931. EXTERN_API( OSErr )
  932. PMgrStateQInstall                (PMgrQueueElement *        theElement)                            TWOWORDINLINE(0x7022, 0xA09E);
  933.  
  934.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  935.                                                                                             #pragma parameter __D0 PMgrStateQRemove(__A0)
  936.                                                                                             #endif
  937. EXTERN_API( OSErr )
  938. PMgrStateQRemove                (PMgrQueueElement *        theElement)                            TWOWORDINLINE(0x7023, 0xA09E);
  939.  
  940.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  941.                                                                                             #pragma parameter __D0 UpdateSystemActivity(__D0)
  942.                                                                                             #endif
  943. EXTERN_API( OSErr )
  944. UpdateSystemActivity            (UInt8                     activity)                            FOURWORDINLINE(0x4840, 0x303C, 0x0024, 0xA09E);
  945.  
  946.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  947.                                                                                             #pragma parameter __D0 DelaySystemIdle
  948.                                                                                             #endif
  949. EXTERN_API( OSErr )
  950. DelaySystemIdle                    (void)                                                        TWOWORDINLINE(0x7025, 0xA09E);
  951.  
  952.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  953.                                                                                             #pragma parameter __D0 GetStartupTimer(__A0)
  954.                                                                                             #endif
  955. EXTERN_API( OSErr )
  956. GetStartupTimer                    (StartupTime *            theTime)                            TWOWORDINLINE(0x7026, 0xA09E);
  957.  
  958.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  959.                                                                                             #pragma parameter __D0 SetStartupTimer(__A0)
  960.                                                                                             #endif
  961. EXTERN_API( OSErr )
  962. SetStartupTimer                    (StartupTime *            theTime)                            TWOWORDINLINE(0x7027, 0xA09E);
  963.  
  964.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  965.                                                                                             #pragma parameter __D0 GetLastActivity(__A0)
  966.                                                                                             #endif
  967. EXTERN_API( OSErr )
  968. GetLastActivity                    (ActivityInfo *            theActivity)                        TWOWORDINLINE(0x7028, 0xA09E);
  969.  
  970.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  971.                                                                                             #pragma parameter __D0 GetSoundMixerState(__A0)
  972.                                                                                             #endif
  973. EXTERN_API( OSErr )
  974. GetSoundMixerState                (SoundMixerByte *        theSoundMixerByte)                    TWOWORDINLINE(0x7029, 0xA09E);
  975.  
  976.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  977.                                                                                             #pragma parameter __D0 SetSoundMixerState(__A0)
  978.                                                                                             #endif
  979. EXTERN_API( OSErr )
  980. SetSoundMixerState                (SoundMixerByte *        theSoundMixerByte)                    TWOWORDINLINE(0x702A, 0xA09E);
  981.  
  982.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  983.                                                                                             #pragma parameter __D0 GetDimSuspendState
  984.                                                                                             #endif
  985. EXTERN_API( Boolean )
  986. GetDimSuspendState                (void)                                                        TWOWORDINLINE(0x702B, 0xA09E);
  987.  
  988.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  989.                                                                                             #pragma parameter SetDimSuspendState(__D0)
  990.                                                                                             #endif
  991. EXTERN_API( void )
  992. SetDimSuspendState                (Boolean                 dimSuspendState)                    FOURWORDINLINE(0x4840, 0x303C, 0x002C, 0xA09E);
  993.  
  994.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  995.                                                                                             #pragma parameter __D0 GetCoreProcessorTemperature(__A0)
  996.                                                                                             #endif
  997. EXTERN_API( SInt32 )
  998. GetCoreProcessorTemperature        (MPCpuID                 inCpuID)                            TWOWORDINLINE(0x702D, 0xA09E);
  999.  
  1000.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1001.                                                                                             #pragma parameter __D0 GetWakeOnNetworkOptions
  1002.                                                                                             #endif
  1003. EXTERN_API( OptionBits )
  1004. GetWakeOnNetworkOptions            (void)                                                        TWOWORDINLINE(0x702E, 0xA09E);
  1005.  
  1006.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1007.                                                                                             #pragma parameter SetWakeOnNetworkOptions(__A0)
  1008.                                                                                             #endif
  1009. EXTERN_API( void )
  1010. SetWakeOnNetworkOptions            (OptionBits             inOptions)                            TWOWORDINLINE(0x702F, 0xA09E);
  1011.  
  1012.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1013.                                                                                             #pragma parameter __D0 AddPowerSource(__A0)
  1014.                                                                                             #endif
  1015. EXTERN_API( OSStatus )
  1016. AddPowerSource                    (PowerSourceParamBlock * ioPowerSource)                        TWOWORDINLINE(0x7030, 0xA09E);
  1017.  
  1018.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1019.                                                                                             #pragma parameter __D0 RemovePowerSource(__D0)
  1020.                                                                                             #endif
  1021. EXTERN_API( OSStatus )
  1022. RemovePowerSource                (PowerSourceID             inSourceID)                            FOURWORDINLINE(0x4840, 0x303C, 0x0031, 0xA09E);
  1023.  
  1024.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1025.                                                                                             #pragma parameter __D0 UpdatePowerSource(__A0)
  1026.                                                                                             #endif
  1027. EXTERN_API( OSStatus )
  1028. UpdatePowerSource                (PowerSourceParamBlock * ioSource)                            TWOWORDINLINE(0x7032, 0xA09E);
  1029.  
  1030. EXTERN_API( Boolean )
  1031. IsServerModeEnabled                (void)                                                        TWOWORDINLINE(0x7033, 0xA09E);
  1032.  
  1033. EXTERN_API( void )
  1034. EnableServerMode                (Boolean                 inEnable)                            FOURWORDINLINE(0x4840, 0x303C, 0x0034, 0xA09E);
  1035.  
  1036. /* Power Handler Management */
  1037. EXTERN_API_C( Boolean )
  1038. IsPCIPowerOffDisabled            (void);
  1039.  
  1040. EXTERN_API_C( void )
  1041. EnablePCIPowerOff                (Boolean                 inEnable);
  1042.  
  1043. EXTERN_API_C( OSStatus )
  1044. AddDevicePowerHandler            (RegEntryIDPtr             regEntryID,
  1045.                                  PowerHandlerProcPtr     handler,
  1046.                                  UInt32                 refCon,
  1047.                                  char *                    deviceType);
  1048.  
  1049. EXTERN_API_C( OSStatus )
  1050. RemoveDevicePowerHandler        (RegEntryIDPtr             regEntryID);
  1051.  
  1052. EXTERN_API_C( OSStatus )
  1053. RemoveDevicePowerHandlerForProc    (PowerHandlerProcPtr     proc);
  1054.  
  1055. EXTERN_API_C( OSStatus )
  1056. GetDevicePowerLevel                (RegEntryIDPtr             regEntryID,
  1057.                                  PowerLevel *            devicePowerLevel);
  1058.  
  1059. EXTERN_API_C( OSStatus )
  1060. SetDevicePowerLevel                (RegEntryIDPtr             regEntryID,
  1061.                                  PowerLevel             devicePowerLevel);
  1062.  
  1063.  
  1064. #if OPAQUE_UPP_TYPES
  1065.     EXTERN_API(SleepQUPP)
  1066.     NewSleepQUPP                   (SleepQProcPtr            userRoutine);
  1067.  
  1068.     EXTERN_API(HDSpindownUPP)
  1069.     NewHDSpindownUPP               (HDSpindownProcPtr        userRoutine);
  1070.  
  1071.     EXTERN_API(PMgrStateChangeUPP)
  1072.     NewPMgrStateChangeUPP           (PMgrStateChangeProcPtr    userRoutine);
  1073.  
  1074.     EXTERN_API(void)
  1075.     DisposeSleepQUPP               (SleepQUPP                userUPP);
  1076.  
  1077.     EXTERN_API(void)
  1078.     DisposeHDSpindownUPP           (HDSpindownUPP            userUPP);
  1079.  
  1080.     EXTERN_API(void)
  1081.     DisposePMgrStateChangeUPP       (PMgrStateChangeUPP        userUPP);
  1082.  
  1083.     EXTERN_API(long)
  1084.     InvokeSleepQUPP                   (long                    message,
  1085.                                     SleepQRecPtr            qRecPtr,
  1086.                                     SleepQUPP                userUPP);
  1087.  
  1088.     EXTERN_API(void)
  1089.     InvokeHDSpindownUPP               (HDQueueElement *        theElement,
  1090.                                     HDSpindownUPP            userUPP);
  1091.  
  1092.     EXTERN_API(void)
  1093.     InvokePMgrStateChangeUPP       (PMgrQueueElement *        theElement,
  1094.                                     long                    stateBits,
  1095.                                     PMgrStateChangeUPP        userUPP);
  1096.  
  1097. #else
  1098.     enum { uppSleepQProcInfo = 0x00131832 };                         /* register 4_bytes:D0 Func(4_bytes:D0, 4_bytes:A0) */
  1099.     enum { uppHDSpindownProcInfo = 0x000000C0 };                     /* pascal no_return_value Func(4_bytes) */
  1100.     enum { uppPMgrStateChangeProcInfo = 0x000003C0 };                 /* pascal no_return_value Func(4_bytes, 4_bytes) */
  1101.     #define NewSleepQUPP(userRoutine)                                 (SleepQUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppSleepQProcInfo, GetCurrentArchitecture())
  1102.     #define NewHDSpindownUPP(userRoutine)                             (HDSpindownUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppHDSpindownProcInfo, GetCurrentArchitecture())
  1103.     #define NewPMgrStateChangeUPP(userRoutine)                         (PMgrStateChangeUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppPMgrStateChangeProcInfo, GetCurrentArchitecture())
  1104.     #define DisposeSleepQUPP(userUPP)                                 DisposeRoutineDescriptor(userUPP)
  1105.     #define DisposeHDSpindownUPP(userUPP)                             DisposeRoutineDescriptor(userUPP)
  1106.     #define DisposePMgrStateChangeUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  1107.     #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  1108.     #pragma parameter __D0 InvokeSleepQUPP(__D0, __A0, __A1)
  1109.     long InvokeSleepQUPP(long message, SleepQRecPtr qRecPtr, SleepQUPP userUPP) = 0x4E91;
  1110.     #else
  1111.         #define InvokeSleepQUPP(message, qRecPtr, userUPP)                 (long)CALL_TWO_PARAMETER_UPP((userUPP), uppSleepQProcInfo, (message), (qRecPtr))
  1112.     #endif
  1113.     #define InvokeHDSpindownUPP(theElement, userUPP)                 CALL_ONE_PARAMETER_UPP((userUPP), uppHDSpindownProcInfo, (theElement))
  1114.     #define InvokePMgrStateChangeUPP(theElement, stateBits, userUPP)  CALL_TWO_PARAMETER_UPP((userUPP), uppPMgrStateChangeProcInfo, (theElement), (stateBits))
  1115. #endif
  1116. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  1117. #define NewSleepQProc(userRoutine)                                 NewSleepQUPP(userRoutine)
  1118. #define NewHDSpindownProc(userRoutine)                             NewHDSpindownUPP(userRoutine)
  1119. #define NewPMgrStateChangeProc(userRoutine)                     NewPMgrStateChangeUPP(userRoutine)
  1120. #define CallSleepQProc(userRoutine, message, qRecPtr)            InvokeSleepQUPP(message, qRecPtr, userRoutine)
  1121. #define CallHDSpindownProc(userRoutine, theElement)                InvokeHDSpindownUPP(theElement, userRoutine)
  1122. #define CallPMgrStateChangeProc(userRoutine, theElement, stateBits) InvokePMgrStateChangeUPP(theElement, stateBits, userRoutine)
  1123.  
  1124.  
  1125. #if PRAGMA_STRUCT_ALIGN
  1126.     #pragma options align=reset
  1127. #elif PRAGMA_STRUCT_PACKPUSH
  1128.     #pragma pack(pop)
  1129. #elif PRAGMA_STRUCT_PACK
  1130.     #pragma pack()
  1131. #endif
  1132.  
  1133. #ifdef PRAGMA_IMPORT_OFF
  1134. #pragma import off
  1135. #elif PRAGMA_IMPORT
  1136. #pragma import reset
  1137. #endif
  1138.  
  1139. #ifdef __cplusplus
  1140. }
  1141. #endif
  1142.  
  1143. #endif /* __POWER__ */
  1144.  
  1145.